package com.lazycoffee.lcloancalculator.components

import com.tencent.kuikly.core.base.ComposeAttr
import com.tencent.kuikly.core.base.ComposeEvent
import com.tencent.kuikly.core.base.ComposeView
import com.tencent.kuikly.core.base.ViewBuilder
import com.tencent.kuikly.core.base.ViewContainer
import com.tencent.kuikly.core.views.Text

internal class LabelAttr : ComposeAttr() {
    var labelText: String = "标签"
}

internal class FormLabelView : ComposeView<LabelAttr, ComposeEvent>() {
    override fun createAttr(): LabelAttr {
        return LabelAttr()
    }

    override fun createEvent(): ComposeEvent {
        return ComposeEvent()
    }

    override fun body(): ViewBuilder {
        val ctx = this
        return {
            Text {
                attr {
                    fontSize(16F)
                    text(ctx.attr.labelText)
                    marginBottom(3F)
                }
            }
        }
    }
}
internal fun ViewContainer<*,*>.FormLabel(init: FormLabelView.() -> Unit) {
    addChild(FormLabelView(), init)
}